<!DOCTYPE html>
  <html>
  <head>
      <meta charset="utf-8">
      <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
      <title>title</title>
      <link rel="stylesheet" type="text/css" href="./css/api.css"/>
      <link rel="stylesheet" type="text/css" href="./css/aui.css" />
      <style>
          body{

          }
      </style>
  </head>
  <body>
    <header class="aui-bar aui-bar-nav">登录页面</header>
    <form >
<ul class="aui-list aui-form-list">
            <li class="aui-list-header">欢迎登录系统
            <li v-for="item in list" class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label-icon">
                        <i class="aui-iconfont aui-icon-mobile"></i>
                    </div>
                    <div class="aui-list-item-input">
                        <input name='username' type="text" placeholder="username">
                    </div>
                </div>
            </li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label-icon">
                        <i class="aui-iconfont aui-icon-lock"></i>
                    </div>
                    <div class="aui-list-item-input">
                        <input id = 'ps' name = 'ps' type="password" placeholder="password">
                    </div>
                    <div class="aui-list-item-label-icon">
                        <i onclick = 'showps();' class="aui-iconfont aui-icon-display"></i>
                    </div>
                </div>
            </li>
            <!-- sssssssssssssssssssssssss  -->


            <li class="aui-list-item">
                <div class="aui-list-item-inner aui-list-item-center aui-list-item-btn">
                    <div onclick = 'denglu();' class="aui-btn aui-btn-info aui-margin-r-5">登录</div>
                    <div onclick ='regist();' class="aui-btn aui-btn-info aui-margin-r-5">注册</div>
                </div>
            </li>

        </ul>
        </form>

  </body>
  <script type="text/javascript" src="./script/api.js"></script>
  <script type="text/javascript" src="./script/vue.js"></script>
  <script type="text/javascript" src="./script/jquery-1.12.4.min.js"></script>
  <script type="text/javascript" src="./layer/layer.js"></script>
  <script type="text/javascript" src="./script/init.js" ></script>


  <script type="text/javascript">
      regist = function () {
        api.openWin({
            name: 'regist',
            url: './html/regist.html',
            pageParam: {
                name: 'test'
            }
        });

      }
      denglu2 = function(toLocal){

        api.openWin({
            name: toLocal,
            url: `./${toLocal}.html`,
            pageParam: {
                name: 'test'
            }
        });
      }
      var index = 0;
      denglu = function () {
        index = layer.load();
        $.ajax({
        url:bashUrl+'login',
        type:"POST",
        data:$('form').serialize(),
        timeout:8000,
        dataType:"json",
        success:callback,
        error: function () {
          layer.close(index)
          api.toast({msg:"登录失败,请求超时或繁忙",duration : 2000})
        }
        });
      }


      callback = function(data){
        layer.close(index)
        if(data.meg === '1'){
          console.log(JSON.stringify(data.user))
          localStorage.setItem("user",JSON.stringify(data.user))
          if(data.user.usertype === 2){
            denglu2("index")
          }else{
            denglu2("userindex")
          }
        }else{
          api.toast({msg:"登录失败,账号密码错误",duration : 2000})
        }
      }















      var biaozhi = true
      showps = function () {
        if(biaozhi){
          biaozhi = false
          $('#ps')[0].type = 'text'
        }else{
          biaozhi = true
          $('#ps')[0].type = 'password'
        }

      }

      apiready = function(){

      };
  </script>
  </html>
